package com.bestow.lease.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bestow.common.annotation.Log;
import com.bestow.common.core.controller.BaseController;
import com.bestow.common.core.domain.AjaxResult;
import com.bestow.common.enums.BusinessType;
import com.bestow.lease.domain.HlsBpMasterBankAccount;
import com.bestow.lease.service.IHlsBpMasterBankAccountService;
import com.bestow.common.utils.poi.ExcelUtil;
import com.bestow.common.core.page.TableDataInfo;

/**
 * 商业伙伴银行账户信息Controller
 * 
 * @author liliu
 * @date 2022-09-26
 */
@RestController
@RequestMapping("/lease/bpMasterBankAccount")
public class HlsBpMasterBankAccountController extends BaseController
{
    @Autowired
    private IHlsBpMasterBankAccountService hlsBpMasterBankAccountService;

    /**
     * 查询商业伙伴银行账户信息列表
     */
    @PreAuthorize("@ss.hasPermi('lease:bpMasterBankAccount:list')")
    @GetMapping("/list")
    public TableDataInfo list(HlsBpMasterBankAccount hlsBpMasterBankAccount)
    {
        startPage();
        List<HlsBpMasterBankAccount> list = hlsBpMasterBankAccountService.selectHlsBpMasterBankAccountList(hlsBpMasterBankAccount);
        return getDataTable(list);
    }

    /**
     * 导出商业伙伴银行账户信息列表
     */
    @PreAuthorize("@ss.hasPermi('lease:bpMasterBankAccount:export')")
    @Log(title = "商业伙伴银行账户信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, HlsBpMasterBankAccount hlsBpMasterBankAccount)
    {
        List<HlsBpMasterBankAccount> list = hlsBpMasterBankAccountService.selectHlsBpMasterBankAccountList(hlsBpMasterBankAccount);
        ExcelUtil<HlsBpMasterBankAccount> util = new ExcelUtil<HlsBpMasterBankAccount>(HlsBpMasterBankAccount.class);
        util.exportExcel(response, list, "商业伙伴银行账户信息数据");
    }

    /**
     * 获取商业伙伴银行账户信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('lease:bpMasterBankAccount:query')")
    @GetMapping(value = "/{bankAccountId}")
    public AjaxResult getInfo(@PathVariable("bankAccountId") Long bankAccountId)
    {
        return AjaxResult.success(hlsBpMasterBankAccountService.selectHlsBpMasterBankAccountByBankAccountId(bankAccountId));
    }

    /**
     * 新增商业伙伴银行账户信息
     */
    @PreAuthorize("@ss.hasPermi('lease:bpMasterBankAccount:add')")
    @Log(title = "商业伙伴银行账户信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HlsBpMasterBankAccount hlsBpMasterBankAccount)
    {
        return toAjax(hlsBpMasterBankAccountService.insertHlsBpMasterBankAccount(hlsBpMasterBankAccount));
    }

    /**
     * 修改商业伙伴银行账户信息
     */
    @PreAuthorize("@ss.hasPermi('lease:bpMasterBankAccount:edit')")
    @Log(title = "商业伙伴银行账户信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HlsBpMasterBankAccount hlsBpMasterBankAccount)
    {
        return toAjax(hlsBpMasterBankAccountService.updateHlsBpMasterBankAccount(hlsBpMasterBankAccount));
    }

    /**
     * 删除商业伙伴银行账户信息
     */
    @PreAuthorize("@ss.hasPermi('lease:bpMasterBankAccount:remove')")
    @Log(title = "商业伙伴银行账户信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{bankAccountIds}")
    public AjaxResult remove(@PathVariable Long[] bankAccountIds)
    {
        return toAjax(hlsBpMasterBankAccountService.deleteHlsBpMasterBankAccountByBankAccountIds(bankAccountIds));
    }
}
